﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.IO;
using System.Xml;
using DataLayer;

namespace DataImporterConsole.Screens {
    public class ScreenLibrary {
        private Dictionary<string, IScreen> ScreenDictionary = new Dictionary<string, IScreen>();
        private IScreen CurrentScreen;

        public string InputError {
            get { return "Input error, try again: "; }
        }

        public ScreenLibrary() {
            ScreenDictionary.Add("intro", new IntroScreen());
            ScreenDictionary.Add("import", new ImportScreen());
            CurrentScreen = ScreenDictionary["intro"];
        }

        public void Display() {
            CurrentScreen.Display();
        }

        public void Action(char cki) {
            CurrentScreen.Action(cki);
        }

        public bool isValidInput(char cki) {
            return CurrentScreen.isValidInput(cki);
        }
    }

    interface IScreen {
        void Display();
        bool isValidInput(char cki);
        void Action(char cki);
        string Navigate { get; set; }
    }

    public abstract class Screen : IScreen {
        protected static string screenbase = "Choose your operation or type '+' to quit \r\n\r\n {0} \r\n Make your choice: ";
        protected string _navigate = "intro";

        #region IScreen Members

        public abstract void Display();
        public abstract bool isValidInput(char cki);
        public abstract void Action(char cki);
        public string Navigate { get { return _navigate; } set { _navigate = value; } }

        #endregion
    }
}
